package CI.aufgabe2.cip.mynodes;

import CI.aufgabe2.cip.SymbolTable;
import CI.aufgabe2.cip.base.AbstractDescr;

public class MyRepeatNode extends MyAbstractNode {

	private static final long serialVersionUID = 1L;

	private final MyStatementSequenceNode sequence;
	private final MyAbstractNode expression;

	public MyRepeatNode(MyStatementSequenceNode sequence,
			MyAbstractNode expression) {
		this.sequence = sequence;
		this.expression = expression;
	}

	public MyStatementSequenceNode getSequence() {
		return sequence;
	}

	public MyAbstractNode getExpression() {
		return expression;
	}

	@Override
	public void print() {
		trace("RepeatNode ");
		if (sequence != null)
			sequence.print();

		if (expression != null)
			expression.print();

		unindent();
	}
	
	
	
	public AbstractDescr compile(SymbolTable sym) {
		int label = getNextLabelNumber();
		write("LABEL, "+ label);
		sequence.compile(sym);
		expression.compile(sym);
		write("BF, "+label);
		return null;
	}

}
